﻿using System;
using System.Windows.Data;
using System.Windows.Media;

namespace Examples.Converters
{
    public class EventTypeDimConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var color = Colors.Transparent;

            if (value.ToString().Contains("InformationEvent"))
                color = Color.FromArgb(255, 118, 214, 216);
            else if (value.ToString().Contains("ClientErrorEvent"))
                color = Color.FromArgb(255, 249, 172, 153);
            else if (value.ToString().Contains("ErrorEvent"))
                color = Color.FromArgb(255, 249,172,153);
            else if (value.ToString().Contains("WarningEvent"))
                color = Color.FromArgb(255, 250,251,146);
            else
                color = Color.FromArgb(255, 110, 110, 110);

            return new SolidColorBrush(color);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return null;
        }
    }
}